package org.javaboy.vhr.controller.custom.project;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.javaboy.vhr.model.RespBean;
import org.javaboy.vhr.model.custom.Project;
import org.javaboy.vhr.service.custom.ProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 项目信息请求处理
 * @author <a href="mailto:zhoujb@smartdot.com.cn">zhoujb</a>
 * @version 1.0, 2020/8/19
 */
@RestController
@Api(tags = "项目相关接口")
@RequestMapping("/project/basic")
public class ProjectController {
    @Autowired
    private ProjectService projectService;
    @PostMapping("/")
    @ApiOperation("添加项目")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "project",value = "项目信息",required = true,dataType = "Project")
    })
    public RespBean addProject(@RequestBody(required = true) Project project){
        if (projectService.insert(project) == 1) {
            return RespBean.ok("添加成功");
        }
        return RespBean.error("添加失败");
    }
}
